﻿CREATE TABLE [dbo].[TeamRolesForLocations] (
    [Id]                    INT IDENTITY (1, 1) NOT NULL,
    [TeamRoleForLocationID] INT NOT NULL,
    [LocationID]            INT NOT NULL,
    [TeamMemberID]          INT NOT NULL,
    CONSTRAINT [PK_TeamRolesForLocations] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_LocationTeamRolesForLocation] FOREIGN KEY ([LocationID]) REFERENCES [dbo].[Locations] ([Id]),
    CONSTRAINT [FK_TeamRolesTeamRolesForLocation] FOREIGN KEY ([TeamRoleForLocationID]) REFERENCES [dbo].[Lookups] ([LookupID])
);


GO
CREATE NONCLUSTERED INDEX [IX_FK_LocationTeamRolesForLocation]
    ON [dbo].[TeamRolesForLocations]([LocationID] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_FK_TeamRolesTeamRolesForLocation]
    ON [dbo].[TeamRolesForLocations]([TeamRoleForLocationID] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_FK_TeamMemberTeamRolesForLocation]
    ON [dbo].[TeamRolesForLocations]([TeamMemberID] ASC);

